package com.atguigu.practice;

import java.util.Scanner;
import java.util.Stack;

public class ContinueOne {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        Stack<Integer> stack=new Stack<>();
        int n=scanner.nextInt();
        while(n!=0){
            stack.push(n%2);
            n/=2;
        }
        StringBuilder sb=new StringBuilder();
        while(!stack.isEmpty()){
            sb.append(stack.pop());
        }
        String s=sb.toString();
        int max=0;
        int tmp=0;
        for(int i=0;i<s.length();i++){
            char ch=s.charAt(i);
            if(ch=='1'){
                tmp++;
            }else{
                tmp=0;
            }
            if(tmp>max){
                max=tmp;
            }
        }
        System.out.println(max);
    }
}
